package com.wuxiaofan.order.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wuxiaofan.order.entity.OrderReturnReason;
import com.wuxiaofan.order.entity.custom.OrderReturnReasonCustom;
import com.wuxiaofan.order.mapper.OrderReturnReasonMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wuxiaofan.order.client.Idgenerator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;

@Service
public class OrderReturnReasonService {
    @Autowired
    private OrderReturnReasonMapper omsOrderReturnReasonMapper;
    @Resource
    private Idgenerator idgenerator;
    public OrderReturnReason findById(String id){
        return omsOrderReturnReasonMapper.selectById(id);
    }

    public OrderReturnReasonCustom findCountByMap(Map paraMap){
        return omsOrderReturnReasonMapper.findCountByMap(paraMap);
    }

    public OrderReturnReasonCustom findGroupByMap(Map paraMap){
        return omsOrderReturnReasonMapper.findGroupByMap(paraMap);
    }

    public List<OrderReturnReasonCustom> findByMap(Map paraMap){
        return omsOrderReturnReasonMapper.findByMap(paraMap);
    }

    public Page<OrderReturnReasonCustom> findByMap(Map paraMap, Page page){
        return page.setRecords(omsOrderReturnReasonMapper.findByMap(paraMap,page));
    }


    public void updateMapById(Map paraMap){
        omsOrderReturnReasonMapper.updateMapById(paraMap);
    }
    public void delById(String id){
        omsOrderReturnReasonMapper.deleteById(id);
    }

    public OrderReturnReason save(OrderReturnReason omsOrderReturnReason){
        omsOrderReturnReason.setId(idgenerator.getId());
        omsOrderReturnReasonMapper.insert(omsOrderReturnReason);
        return omsOrderReturnReason;
    }

}
